<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2021/4/28
  Time: 22:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--通过taglib标签引入所需的标签库--%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
        body{
            font-family:宋体;
            font-size: 30px;
        }
        nav{
            font-size: 20px;
            width: 100%;
            background-color: white;
            margin-bottom: 10px;
        }
        nav a{
            text-decoration: none;
            color: black;
        }
        nav a:hover{
            color: #0AB4F7;
        }
        .container{
            width: 100%;
            height: 100%;
            background-color: lightgray;
            margin: 10px auto;
            padding: 10px;
        }
        .user-comment{
            margin: 5px auto;
            float: bottom;
            width: 80%;
            height: 90px;
            text-align: center;
        }
        .user-comment textarea{
            margin-top: 10px;
            width: 80%;
            height: 50px;
            font-size: 20px;
            font-family:宋体;
            border-radius: 5px;
            padding: 10px;
            float: left;
        }
        .user-comment button{
            font-size: 20px;
            font-family:宋体;
            background-color: deepskyblue;
            color: white;
            height:40px;
            border-radius: 5px;
            border: 1px solid;
        }
        .comment-area{
            font-size: 20px;
            border: 1px solid black;
            height: 520px;
            width: 80%;
            margin: 20px auto;
            background-color: whitesmoke;
            padding: 10px;
        }
        .comment-area .new{
            border-bottom: 1px solid black;
            height: 80px;
            padding: 10px;
            background-color: rgba(0,0,0,0.05);
            border-radius: 5px;
        }
        .comment-area .new .user{
            float: left;
            width: 100%;
            height: 30px;

        }
        .comment-area .new  .user-new{
            margin-top: 10px;
            width: 80%;
            height: 55px;
            font-size: 25px;
            overflow: hidden;
        }
        .comment-area .new .date{
            float:right;
            width: 100%;
            text-align: right;
            font-size: 15px;
            /*margin-top: 10px;*/
        }

    </style>
</head>
<nav>
    <a href="Home.jsp">首页</a>
    <%if(session.getAttribute("iden").equals("admin")){%><a href="showTable2"><%}else{%><a href="showTable"><%}%>图书目录</a>
    <a href="showBorrow">读者中心</a>
    <a href="showComment">评论区</a>
</nav>
<div class="container">
    <div class="comment-area">
    <table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" id="table1">
        <tbody>
        <tr>
            <th></th>
        </tr>
        <tr>
            <c:forEach var="comment" items="${list}">
            <td>
<%--                <div class="comment-area">--%>
                <div class="new">
                <div class="user">
                    <c:if test="${comment.type==1}">
                        <p style="color: #ff0000">${comment.uName}(admin):</p>
                    </c:if>
                    <c:if test="${comment.type==0}">
                      ${comment.uName}:
                    </c:if>
                </div>
                <br>
                <div class="user-new">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${comment.contest}
                </div>
                <div class="date" >${comment.time}</div>
                </div>
<%--                </div>--%>
            </td>
        </tr>
        </c:forEach>
        <tr align="center">
            <th colspan="8">
                当前页数${iPage}/${iPageCnt}
                <c:if test="${iPage>1}">
                    <a href="showComment?page=1">第一页</a>
                    <a href="showComment?page=${iPage-1}">上一页</a>
                </c:if>
                <c:if test="${iPage<requestScope.iPageCnt}">
                    <a href="showComment?page=${iPage+1}">下一页</a>
                    <a href="showComment?page=${iPageCnt}">页尾</a>
                </c:if>
            </th>
        </tr>
        </tbody>
    </table>
    </div>
</div>
<hr>
<div class="user-comment">
<%--    <textarea  name="comment" placeholder="请输入你的评论" rows="5"></textarea><br>--%>
<%--    <button type="submit" formaction="addComment">发送</button>--%>
    <form action="addComment">
        <textarea  name="comment" placeholder="请输入你的评论" rows="5"></textarea><br>
        <button type="submit">评论</button>
    </form>
</div>
</div>
</body>
</html>
